package com.xm.servlet.background.orders;

import com.xm.service.background.OrdersService;
import lombok.SneakyThrows;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 修改订单状态
 * @author 康文程
 * @date 2024-1-15
 */
@WebServlet("/background/modify/orders/status")
public class ModifyOrdersStatus extends HttpServlet {
    /**
     * OrderService
     */
    private final OrdersService service = new OrdersService();
    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String status = req.getParameter("status");
        String orderId = req.getParameter("orderId");
        resp.getWriter().print(service.updateOrderStatusByOrderId(orderId,Integer.parseInt(status)));
    }
}
